package com.hsnn.medstgmini.base.dict.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;



/**
 * 地区字典
 * @author qiulei
 *
 */
@Entity
@Table(name = "dic_area")
public class DicArea implements Serializable {

	private static final long serialVersionUID = 1L;
	private String areaId;
	private String areaName;
	private String arFullName;
	private String arShortName;
	private int status;
	private String updateUserId;
	private Date updDatetime;
	private int sortid;
	private DicArea father;
	private String fatherAreaCode;
	private String fatherAreaName;
	
	@Transient
	public String getFatherAreaCode() {
		return fatherAreaCode;
	}
	public void setFatherAreaCode(String fatherAreaCode) {
		this.fatherAreaCode = fatherAreaCode;
	}
	
	@Transient
	public String getFatherAreaName() {
		return fatherAreaName;
	}
	public void setFatherAreaName(String fatherAreaName) {
		this.fatherAreaName = fatherAreaName;
	}
	
	@Id
	@Column(name = "area_id")
	public String getAreaid() {
		return areaId;
	}
	public void setAreaid(String areaId) {
		this.areaId = areaId;
	}
	
	@Column(name = "area_name")
	public String getAreaname() {
		return areaName;
	}
	public void setAreaname(String areaName) {
		this.areaName = areaName;
	}

	@Column(name = "ar_fullname")
	public String getArfullname() {
		return arFullName;
	}
	public void setArfullname(String arFullName) {
		this.arFullName = arFullName;
	}
	
	@Column(name = "ar_shortname")
	public String getArshortname() {
		return arShortName;
	}
	public void setArshortname(String arShortName) {
		this.arShortName = arShortName;
	}
	
	@Column(name = "status")
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	
	@Column(name = "upd_user")
	public String getUpdateuserid() {
		return updateUserId;
	}
	public void setUpdateuserid(String updateUserId) {
		this.updateUserId = updateUserId;
	}
	
	@Column(name = "sort_id")
	public int getSortid() {
		return sortid;
	}
	public void setSortid(int sortid) {
		this.sortid = sortid;
	}
	
	@Column(name = "upd_datetime")
	public Date getUpdDatetime() {
		return updDatetime;
	}
	public void setUpdDatetime(Date updDatetime) {
		this.updDatetime = updDatetime;
	}
	
	@javax.persistence.ManyToOne(cascade = { CascadeType.ALL })
	@NotFound(action=NotFoundAction.IGNORE)
	@JoinColumn(name = "father_id")
	public DicArea getFather() {
		return father;
	}
	public void setFather(DicArea father) {
		this.father = father;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((arFullName == null) ? 0 : arFullName.hashCode());
		result = prime * result
				+ ((arShortName == null) ? 0 : arShortName.hashCode());
		result = prime * result + ((areaId == null) ? 0 : areaId.hashCode());
		result = prime * result
				+ ((areaName == null) ? 0 : areaName.hashCode());
		result = prime * result + ((father == null) ? 0 : father.hashCode());
		result = prime * result
				+ ((fatherAreaCode == null) ? 0 : fatherAreaCode.hashCode());
		result = prime * result
				+ ((fatherAreaName == null) ? 0 : fatherAreaName.hashCode());
		result = prime * result + sortid;
		result = prime * result + status;
		result = prime * result
				+ ((updDatetime == null) ? 0 : updDatetime.hashCode());
		result = prime * result
				+ ((updateUserId == null) ? 0 : updateUserId.hashCode());
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		DicArea other = (DicArea) obj;
		if (arFullName == null) {
			if (other.arFullName != null)
				return false;
		} else if (!arFullName.equals(other.arFullName))
			return false;
		if (arShortName == null) {
			if (other.arShortName != null)
				return false;
		} else if (!arShortName.equals(other.arShortName))
			return false;
		if (areaId == null) {
			if (other.areaId != null)
				return false;
		} else if (!areaId.equals(other.areaId))
			return false;
		if (areaName == null) {
			if (other.areaName != null)
				return false;
		} else if (!areaName.equals(other.areaName))
			return false;
		if (father == null) {
			if (other.father != null)
				return false;
		} else if (!father.equals(other.father))
			return false;
		if (fatherAreaCode == null) {
			if (other.fatherAreaCode != null)
				return false;
		} else if (!fatherAreaCode.equals(other.fatherAreaCode))
			return false;
		if (fatherAreaName == null) {
			if (other.fatherAreaName != null)
				return false;
		} else if (!fatherAreaName.equals(other.fatherAreaName))
			return false;
		if (sortid != other.sortid)
			return false;
		if (status != other.status)
			return false;
		if (updDatetime == null) {
			if (other.updDatetime != null)
				return false;
		} else if (!updDatetime.equals(other.updDatetime))
			return false;
		if (updateUserId == null) {
			if (other.updateUserId != null)
				return false;
		} else if (!updateUserId.equals(other.updateUserId))
			return false;
		return true;
	}
	
	@Override
	public String toString() {
		return "DicArea [areaId=" + areaId + ", areaName=" + areaName
				+ ", arFullName=" + arFullName + ", arShortName=" + arShortName
				+ ", status=" + status + ", updateUserId=" + updateUserId
				+ ", updDatetime=" + updDatetime + ", sortid=" + sortid
				+ ", father=" + father + ", fatherAreaCode=" + fatherAreaCode
				+ ", fatherAreaName=" + fatherAreaName + "]";
	}
}